import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入登录页面组件
import Login from '@/views/Login.vue'
// 导入注册页面组件
import Reg from '@/views/Reg.vue'
// 导入布局页面
import Layout from '@/views/Layout'
// 导入二级路由
import Home from '@/views/Layout/components/Home'
import Artcategory from '@/views/Layout/components/Artcategory'
import ArtList from '@/views/Layout/components/ArtList'
import UserInfo from '@/views/Layout/components/UserInfo'
import ChangeAvatar from '@/views/Layout/components/ChangeAvatar'
import ResetPwd from '@/views/Layout/components/ResetPwd'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/login', component: Login },
    { path: '/reg', component: Reg },
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '',
          redirect: 'home'
        },
        {
          path: 'home',
          component: Home
        },
        {
          path: 'artcategory',
          component: Artcategory
        },
        {
          path: 'artlist',
          component: ArtList
        },
        {
          path: 'userinfo',
          component: UserInfo
        },
        {
          path: 'changeavatar',
          component: ChangeAvatar
        },
        {
          path: 'resetpwd',
          component: ResetPwd
        }
      ]
    }
  ]
})

export default router
